// src/api/StudentList.js
import axios from './axios';

export const getAllStudents = async () => {
  try {
    const response = await axios.get('/api/students');
    return response.data;
  } catch (error) {
    console.error('Error fetching students:', error);
    throw error;
  }
};

export const getStudentById = async (id) => {
  try {
    const response = await axios.get(`/api/students/${id}`);
    return response.data;
  } catch (error) {
    console.error(`Error fetching student with id ${id}:`, error);
    throw error;
  }
};



// Add other CRUD operations as needed